package net.maku.module.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;

@TableName("系统用户管理栏目(AgCategoryPermission)实体类")
@Data
public class AgCategoryPermission implements Serializable {
    private static final long serialVersionUID = 413589553981380250L;


    @Schema(description = "关联id")
    private Integer id;

    @Schema(description = "栏目id")
    private Long categoryId;


    @Schema(description = "用户id")
    private Long userId;

    @Schema(description = "栏目权限")
    private String columnPermissions;

    @Schema(description = "按钮权限")
    private String buttonPermissions;

    private String contentPermission;


    @Schema(description = "创建人")
    private Long creator;


    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;


    @Schema(description = "修改人")
    private Long updater;


    @Schema(description = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    public AgCategoryPermission makeCreateEntity(long executor) {
        AgCategoryPermission categoryPermission = new AgCategoryPermission();
        BeanUtils.copyProperties(this, categoryPermission);
        categoryPermission.setCreator(executor);
        return categoryPermission;
    }

    public AgCategoryPermission makeUpdateEntity(AgCategoryPermission categoryPermission,
                                                 long executor) {
        BeanUtils.copyProperties(this, categoryPermission);
        categoryPermission.setUpdater(executor);
        return categoryPermission;
    }


}
